/*
 * Copyright 2011 待到道成日，纵横天地间.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.itcast.web.action.product;

import com.itcast.model.product.Brand;
import com.itcast.service.product.BrandService;
import com.opensymphony.xwork2.ActionSupport;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

/**
 *
 * @author Kang.Cunhua
 */
@Scope("prototype")
@Controller("/control/product/brandfinder")
public class BrandFinder extends ActionSupport {

  @Resource(name="brandServiceImpl")
  private transient BrandService brandService;
  private String message;
  private Brand brand;
  private String code;

  /**
   *
   * @return
   */
  @Override
  public String execute() {
    brand = brandService.find(Brand.class, code);
    return SUCCESS;
  }

  /**
   * @return the brandService
   */
  public BrandService getBrandService() {
    return brandService;
  }

  /**
   * @param brandService the brandService to set
   */
  public void setBrandService(BrandService brandService) {
    this.brandService = brandService;
  }

  /**
   * @return the message
   */
  public String getMessage() {
    return message;
  }

  /**
   * @param message the message to set
   */
  public void setMessage(String message) {
    this.message = message;
  }

  /**
   * @return the brand
   */
  public Brand getBrand() {
    return brand;
  }

  /**
   * @param brand the brand to set
   */
  public void setBrand(Brand brand) {
    this.brand = brand;
  }

  /**
   * @return the code
   */
  public String getCode() {
    return code;
  }

  /**
   * @param code the code to set
   */
  public void setCode(String code) {
    this.code = code;
  }
}
